package com.pubinfo.passbook.engine.cell.hook.medicine.payinformation;

import com.pubinfo.passbook.common.mapper.TSourcePassbookMapper;
import com.pubinfo.passbook.common.model.ruler.PayInformation;
import com.pubinfo.passbook.common.utils.ApplicationContextUilts;

import java.math.BigDecimal;

/**
 * 保存子单可报销金额
 *
 * @author zhouch
 * @date 2022/3/15 14:07
 */
public class SaveReimbursableHook extends PayInformationHookUnit {

    TSourcePassbookMapper tSourcePassbookMapper;

    public SaveReimbursableHook() {
        tSourcePassbookMapper = ApplicationContextUilts.getBean(TSourcePassbookMapper.class);
    }

    @Override
    public void callback(PayInformation data, BigDecimal result) {
        data.setReimbursableSum(result);
        tSourcePassbookMapper.updateReimbursableSumById(data);
    }
}
